// FizzBuzzC++.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
#include "FizzBuzz.h"
using namespace std;


int _tmain(int argc, _TCHAR* argv[])
{
	int i;
	cout << "Insert Number: ";
	cin >> i;

	FizzBuzz fizzBuzz;

	cout << "The Result is: " << fizzBuzz.CallFizzBuzz(i) << "\n";
	cout << "The Result is: " << fizzBuzz.CallFizzBuzzExtended(i);
	return 0;
}

string FizzBuzz::CallFizzBuzz(int number)
{
	if (number <= 0) return to_string(number);

	string result = "";
	if (number % 3 == 0)
	{
		result = "fizz";
	}
	if (number % 5 == 0)
	{
		result = result + "buzz";
	}
	if (result == "")
	{
		result = to_string(number);
	}

	return result;
}

string FizzBuzz::CallFizzBuzzExtended(int number)
{
	if (number <= 0) return to_string(number);

	string result = "";
	string number_str = to_string(number);

	if (number % 3 == 0 || number_str.find("3") != string::npos)
	{
		result = "fizz";
	}
	if (number % 5 == 0 || number_str.find("5") != string::npos)
	{
		result = result + "buzz";
	}
	if (result == "")
	{
		result = number_str;
	}

	return result;
}


